<?php
namespace app\admin\model;

use think\Model;

/**  YSF
 *   订单模型
 *   Date: 2019/1/3
 * Class Order
 * @package app\admin\model
 */
class Order extends Model
{
    // 表名
    protected $name = 'order';

    // 单表列表查询
    public function getAll($where,$field='*',$page=1,$pageSize=999,$order='')
    {
        $result = $this->where($where)
                ->field($field)
                ->page($page, $pageSize)
                ->order($order)
                ->select();
        return $result;
    }

    // 单表数量查询
    public function getCount($where)
    {
        $result = $this->where($where)
                    ->count();
        return $result;
    }

    // 单表单条查询
    public function getOne($where=[],$field='*')
    {
        $result = $this->where($where)->field($field)->find();
        return $result;
    }

    // 编辑操作
    public function edit($where=[],$data=[])
    {
        $result = $this->where($where)->update($data);
        return $result;
    }



}